import { reqAddressInfo } from '@/api'
import { reqOrderInfo } from '@/api'
const state = {
    address: [],
    order: {}
};
const mutations = {
    // 获取用户地址信息
    GETUSERADDRESS(state, address) {
        console.log('address', address);
        state.address = address
    },
    // 获取购物清单
    GETORDER(state, order) {
        state.order = order
    }
};
const actions = {
    // 获取用户地址信息
    async getUserAddress({ commit }) {
        let result = await reqAddressInfo()
        if (result.code == 200) {
            console.log(result);
            commit('GETUSERADDRESS', result.data)
        } else {

        }
    },
    // 获取购买清单
    async getOrder({ commit }) {
        let result = await reqOrderInfo()
        if (result.code == 200) {
            console.log(result);
            commit('GETORDER', result.data)
        } else {

        }
    },
};
const getters = {};
export default {
    state,
    mutations,
    actions,
    getters
}
